Skip to content

Combine all modified and deleted files that been compressed to the prompt - #3

Merged
hussam789 merged 6 commits into
mainfrom
algo/combine_modified_files_one_list
Jul 6, 2023
Merged

hussam789 merged 6 commits into
mainfrom
algo/combine_modified_files_one_list

Conversation

@hussam789

@hussam789 hussam789 commented Jul 6, 2023 •

Copy link
Copy Markdown
Contributor

User description

Description

Add two sections to the the prompt:

  1. More Modified files: all modified file that been compressed into one list
  2. Deleted file: all deleted files into one list

The final PR will have this format :

[PATCH 1]
[PATCH 2]


More modified files:
file_path_3
file_path_5

Deleted files:
file_path_4

instead of:

[PATCH 1]
## file_path_3

File was modified

[PATCH 2]

## file_path_4

File was deleted

## file_path_5

File was modified

All tests pass


PR Type

Enhancement


Description

  • Enhanced PR diff processing by categorizing modified and deleted files into separate lists
  • Updated get_pr_diff and pr_generate_compressed_diff functions to handle new file categorization
  • Modified handling of deleted files in patch processing to return None instead of a string
  • Added new constants for "Deleted files" and "More modified files" sections
  • Updated existing tests to reflect changes in deleted file handling
  • Added comprehensive test suite for sort_files_by_main_languages function
  • Improved type hinting and import statements

Changes walkthrough 📝

Relevant files
Enhancement
git_patch_processing.py
Update deleted file handling in patch processing                 

pr_agent/algo/git_patch_processing.py

  • Modified handling of deleted files: now returns None instead of "File
    was deleted" string
  • +1/-1     
    pr_processing.py
    Enhance PR diff processing with file categorization           

    pr_agent/algo/pr_processing.py

  • Added functionality to combine modified and deleted files into
    separate lists
  • Updated get_pr_diff and pr_generate_compressed_diff functions to
    handle new file lists
  • Introduced new constants for "Deleted files" and "More modified files"
    sections
  • +31/-8   
    Tests
    test_handle_patch_deletions.py
    Update test for deleted file handling                                       

    tests/unit/test_handle_patch_deletions.py

  • Updated test case to expect None instead of "File was deleted" string
    for deleted files
  • +1/-1     
    test_language_handler.py
    Add comprehensive tests for language handling                       

    tests/unit/test_language_handler.py

  • Added new test file for sort_files_by_main_languages function
  • Included various test cases covering different scenarios and edge
    cases
  • +122/-1 

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @hussam789
    hussam789 requested a review from mrT23 July 6, 2023 08:21
    @hussam789 hussam789 changed the title Combine all modified file that been compressed into one list at the end of the PR Combine all modified files and deleted files that been compressed to the prompt Jul 6, 2023
    @hussam789 hussam789 changed the title Combine all modified files and deleted files that been compressed to the prompt Combine all modified and deleted files that been compressed to the prompt Jul 6, 2023
    @hussam789 hussam789 added the enhancement New feature or request label Jul 6, 2023
    @hussam789
    hussam789 merged commit 53e7ff6 into main Jul 6, 2023
    @hussam789
    hussam789 deleted the algo/combine_modified_files_one_list branch July 6, 2023 11:59
    @QodoAI-Agent

    Copy link
    Copy Markdown

    PR Analysis

    • 🎯 Main theme: Refactoring the way modified and deleted files are presented in the PR
    • 🔍 Description and title: Yes
    • 📌 Type of PR: Refactoring
    • 🧪 Relevant tests added: Yes
    • ✨ Minimal and focused: Yes, the PR is focused on changing the presentation of modified and deleted files in the PR
    • 🔒 Security concerns: No, the PR does not introduce possible security concerns or issues.

    PR Feedback

    • 💡 General PR suggestions: The PR is well-structured and follows good practices. The changes are focused and relevant. The use of constants for the strings is a good practice. However, it would be better to use more descriptive variable names for better code readability.

    • 🤖 Code suggestions:

      • relevant file: pr_agent/algo/pr_processing.py
        suggestion content: Consider renaming the variables 'modified_files' and 'deleted_files' to 'modified_file_names' and 'deleted_file_names' respectively, to better reflect their content. [medium]

      • relevant file: pr_agent/algo/pr_processing.py
        suggestion content: Consider adding a comment explaining the logic behind the token counting for the 'modified_files' and 'deleted_files' lists. This would improve code readability and maintainability. [medium]

      • relevant file: pr_agent/algo/pr_processing.py
        suggestion content: Consider refactoring the 'pr_generate_compressed_diff' function to reduce its complexity and improve readability. You could extract the logic for handling modified and deleted files into separate functions. [important]

      • relevant file: pr_agent/algo/pr_processing.py
        suggestion content: Consider adding type hints to the return value of the 'pr_generate_compressed_diff' function to improve code readability and maintainability. [medium]

    How to use

    Tag me in a comment '@CodiumAI-Agent' to ask for a new review after you update the PR.
    You can also tag me and ask any question, for example '@CodiumAI-Agent is the PR ready for merge?'

    @mrT23

    mrT23 commented Jul 7, 2023

    Copy link
    Copy Markdown
    Contributor

    @CodiumAI-Agent summerize me the PR, in 4 bullet points

    @QodoAI-Agent

    Copy link
    Copy Markdown

    Question: summerize me the PR, in 4 bullet points

    Answer:

    • The PR introduces a new format for the final PR, where all modified and deleted files are compressed into separate lists. This is a change from the previous format where each file was listed individually with its status (modified or deleted).
    • The handle_patch_deletions function has been updated to return None instead of the string "File was deleted" when a file has been deleted.
    • The get_pr_diff and pr_generate_compressed_diff functions have been updated to handle the new format, including the addition of modified_file_names and deleted_file_names lists.
    • The PR also includes updates to the unit tests to reflect these changes, and a new test file test_language_handler.py has been added.

    @mrT23

    mrT23 commented Jul 7, 2023

    Copy link
    Copy Markdown
    Contributor

    @CodiumAI-Agent summerize the PR, in 3 bullet points. add small code snippet to explain each one

    @QodoAI-Agent

    Copy link
    Copy Markdown

    Question: summerize the PR, in 3 bullet points. add small code snippet to explain each one

    Answer:

    1. The PR modifies the way deleted files are handled. Instead of appending a string "File was deleted\n" to the patch, it now sets the patch to None. This change is made to facilitate the new way of listing deleted files separately in the final PR format.

      if not new_file_content_str:
          patch = None # file was deleted
    2. The PR modifies the get_pr_diff and pr_generate_compressed_diff functions in pr_processing.py to generate lists of modified and deleted files. These lists are then appended to the final diff string in a new format, where all modified and deleted files are listed under separate headers.

      patches_compressed, modified_file_names, deleted_file_names = pr_generate_compressed_diff(pr_languages, token_handler)
      final_diff = "\n".join(patches_compressed)
      if modified_file_names:
          modified_list_str = MORE_MODIFIED_FILES_ + "\n".join(modified_file_names)
          final_diff = final_diff + "\n\n" + modified_list_str
      if deleted_file_names:
          deleted_list_str = DELETED_FILES_ + "\n".join(deleted_file_names)
          final_diff = final_diff + "\n\n" + deleted_list_str
      return final_diff
    3. The PR includes new unit tests for the sort_files_by_main_languages function in test_language_handler.py. These tests cover different scenarios to ensure the function behaves as expected.

      class TestSortFilesByMainLanguages:
          def test_happy_path_sort_files_by_main_languages(self):
              ...
              assert sort_files_by_main_languages(languages, files) == expected_output

    hussam789 pushed a commit that referenced this pull request Sep 22, 2023
    yochail pushed a commit to yochail/pr-agent that referenced this pull request Feb 11, 2024
    …d_files_one_list
    
    Combine all modified and deleted files that been compressed to the prompt
    yochail pushed a commit to yochail/pr-agent that referenced this pull request Feb 11, 2024
    @mrT23

    mrT23 commented Aug 13, 2024 •

    Copy link
    Copy Markdown
    Contributor

    PR Code Suggestions ✨

    Latest suggestions up to ff720d3

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Correct the return type hint to match the actual return value

    The function pr_generate_compressed_diff is returning a tuple, but the type hint
    suggests it's returning a list. Update the type hint to match the actual return
    value for better type checking and code clarity.

    pr_agent/algo/pr_processing.py [81]

    -def pr_generate_compressed_diff(top_langs: list, token_handler: TokenHandler) -> Tuple(list, list, list):
    +def pr_generate_compressed_diff(top_langs: list, token_handler: TokenHandler) -> Tuple[list, list, list]:
     
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: This suggestion fixes a mismatch between the type hint and the actual return value, which is crucial for correct type checking and code clarity.

    9
    Enhancement
    Use a more specific type hint for the git_provider parameter

    Consider using a more descriptive variable name instead of Any in the type hint for
    git_provider. This will improve code readability and provide better type
    information.

    pr_agent/algo/pr_processing.py [21]

    -def get_pr_diff(git_provider: Union[GithubProvider, Any], token_handler: TokenHandler) -> str:
    +def get_pr_diff(git_provider: Union[GithubProvider, GitProvider], token_handler: TokenHandler) -> str:
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion improves code readability and provides better type information, which is beneficial for maintainability and understanding the code.

    7
    Use a more descriptive variable name for better code readability

    Consider using a more descriptive variable name for patches_compressed to better
    reflect its content, such as compressed_patches or minimized_patches. This will
    improve code readability.

    pr_agent/algo/pr_processing.py [39]

    -patches_compressed, modified_file_names, deleted_file_names = pr_generate_compressed_diff(pr_languages, token_handler)
    +minimized_patches, modified_file_names, deleted_file_names = pr_generate_compressed_diff(pr_languages, token_handler)
     
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: While the suggestion improves code readability, the current variable name is not severely unclear. The improvement is minor but still beneficial.

    5
    Maintainability
    Remove unnecessary generated comment for cleaner code

    Remove the comment "Generated by CodiumAI" as it's not necessary and may cause
    confusion. If needed, add a more descriptive comment about the purpose of the test
    file.

    tests/unit/test_language_handler.py [2]

    -# Generated by CodiumAI
     from pr_agent.algo.language_handler import sort_files_by_main_languages
     
    • Apply this suggestion
    Suggestion importance[1-10]: 3

    Why: Removing the comment is a minor improvement. While it does clean up the code slightly, it doesn't significantly impact functionality or readability.

    3

    Previous suggestions

    Suggestions up to commit ff720d3
    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Use a more specific type hint instead of 'Any' for better code clarity and type safety

    Consider using a more descriptive variable name instead of Any in the type hint for
    git_provider. This will improve code readability and provide better type
    information. For example, you could create a custom type or use a more specific base
    class if available.

    pr_agent/algo/pr_processing.py [21]

    -def get_pr_diff(git_provider: Union[GithubProvider, Any], token_handler: TokenHandler) -> str:
    +def get_pr_diff(git_provider: Union[GithubProvider, GitProvider], token_handler: TokenHandler) -> str:
     
    Suggestion importance[1-10]: 7

    Why: The suggestion improves code readability and type safety by replacing 'Any' with a more specific type, which is a good practice in Python type hinting.

    7
    Suggestions up to commit ff720d3
    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Use a more specific type hint instead of 'Any' for better code clarity and type safety

    Consider using a more descriptive variable name instead of Any in the type hint for
    git_provider. This will improve code readability and provide better type
    information. For example, you could create a custom type or use a more specific base
    class if available.

    pr_agent/algo/pr_processing.py [21]

    -def get_pr_diff(git_provider: Union[GithubProvider, Any], token_handler: TokenHandler) -> str:
    +def get_pr_diff(git_provider: Union[GithubProvider, GitProvider], token_handler: TokenHandler) -> str:
     
    Suggestion importance[1-10]: 7

    Why: The suggestion improves code readability and type safety by replacing 'Any' with a more specific type, which is a good practice in Python type hinting.

    7
    Suggestions up to commit ff720d3
    CategorySuggestion                                                                                                                                    Score
    Best practice
    Specify more detailed type hints for the return type of the function to enhance type safety and code clarity

    To ensure type safety and clarity, modify the return type hint of
    pr_generate_compressed_diff from Tuple(list, list, list) to Tuple[List[str], List[str],
    List[str]]. This change clarifies that the function returns a tuple of lists of strings,
    which is important for understanding the data structure and for proper type checking.

    pr_agent/algo/pr_processing.py [81]

    -def pr_generate_compressed_diff(top_langs: list, token_handler: TokenHandler) -> Tuple(list, list, list):
    +def pr_generate_compressed_diff(top_langs: list, token_handler: TokenHandler) -> Tuple[List[str], List[str], List[str]]:
     
    Suggestion importance[1-10]: 9

    Why: This suggestion improves type safety and code clarity by specifying the exact types in the return hint, which is important for understanding the data structure and for proper type checking.

    9
    Maintainability
    Refactor repetitive conditional checks into a helper function to improve code maintainability and reduce duplication

    Refactor the conditional checks for modified_files and deleted_files to avoid repetitive
    code. This can be achieved by creating a helper function that handles the formatting and
    appending of file lists to final_diff.

    pr_agent/algo/pr_processing.py [127-130]

    -if not modified_files:
    -    total_tokens += token_handler.count_tokens(MORE_MODIFIED_FILES_)
    -modified_files.append(file.filename)
    -total_tokens += token_handler.count_tokens(file.filename) + 1
    -if not deleted_files:
    -    total_tokens += token_handler.count_tokens(DELETED_FILES_)
    -deleted_files.append(file.filename)
    -total_tokens += token_handler.count_tokens(file.filename) + 1
    +def append_file_list(file_list, file_name, header, total_tokens):
    +    if not file_list:
    +        total_tokens += token_handler.count_tokens(header)
    +    file_list.append(file_name)
    +    total_tokens += token_handler.count_tokens(file_name) + 1
    +    return total_tokens
     
    +total_tokens = append_file_list(modified_files, file.filename, MORE_MODIFIED_FILES_, total_tokens)
    +total_tokens = append_file_list(deleted_files, file.filename, DELETED_FILES_, total_tokens)
    +
    Suggestion importance[1-10]: 8

    Why: This refactoring reduces code duplication and improves maintainability by encapsulating repetitive logic into a helper function, making the code cleaner and easier to manage.

    8
    Replace the None assignment with a descriptive message to enhance code readability and maintainability

    Instead of setting patch to None, consider using a more descriptive placeholder or
    maintaining the original behavior of setting patch to a message indicating deletion. This
    change helps in maintaining readability and understanding of the code, especially in
    logging and debugging scenarios.

    pr_agent/algo/git_patch_processing.py [99]

    -patch = None # file was deleted
    +patch = "File was deleted"  # descriptive placeholder for deleted files
     
    Suggestion importance[1-10]: 7

    Why: Using a descriptive placeholder instead of None can improve code readability and debugging. However, the original change to None might have been intentional for a specific reason, so this suggestion is not crucial.

    7
    Enhancement
    Add a check to prevent appending headers and newlines for empty lists of modified or deleted files

    Consider checking the length of modified_file_names and deleted_file_names before
    appending them to final_diff. This change prevents unnecessary newlines and headers from
    being added to final_diff when there are no modified or deleted files, thus keeping the
    output clean and concise.

    pr_agent/algo/pr_processing.py [41-46]

     if modified_file_names:
         modified_list_str = MORE_MODIFIED_FILES_ + "\n".join(modified_file_names)
    -    final_diff = final_diff + "\n\n" + modified_list_str
    +    final_diff += "\n\n" + modified_list_str
     if deleted_file_names:
    -    deleted_list_str = DELETED_FILES_ + "\n".join(deleted_file_names)
    -    final_diff = final_diff + "\n\n" + deleted_list_str
    +    deleted_list_str = DELETED FILES_ + "\n".join(deleted_file_names)
    +    final_diff += "\n\n" + deleted_list_str
     
    Suggestion importance[1-10]: 5

    Why: The suggestion is correct but redundant since the existing code already checks if the lists are non-empty before appending headers and newlines. It doesn't provide a significant improvement.

    5

    @mrT23

    mrT23 commented Aug 13, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Description updated to latest commit (ff720d3)

    mrT23 pushed a commit that referenced this pull request May 25, 2025
    mrT23 pushed a commit that referenced this pull request Jun 18, 2025
    Tyler-Rak referenced this pull request in Tyler-Rak/pr-agent Nov 12, 2025
    - Add new /webhook-parallel endpoint for concurrent PR processing
    - Extract process_webhook() function for shared logic
    - Add configuration options: enable_parallel_reviews, max_concurrent_reviews
    - Implement asyncio.create_task() for true concurrent execution
    - Add semaphore-based concurrency limiting (default: 5 concurrent reviews)
    - Keep original /webhook endpoint unchanged for backward compatibility
    - Add comprehensive architecture documentation with sequence diagrams
    
    Benefits:
    - PR #2 latency: 80s -> 41s (49% improvement)
    - PR #3 latency: 120s -> 42s (65% improvement)
    - 3x throughput improvement
    
    Feature can be enabled by:
    1. Setting bitbucket_app.enable_parallel_reviews=true
    2. Changing webhook URL to /webhook-parallel
    agonzalesipcoop-cmyk pushed a commit to agonzalesipcoop-cmyk/pr-agent that referenced this pull request May 8, 2026
    …view
    
    - Extract loader into pr_agent/algo/best_practices.py and reuse it from
      /improve and /review so OSS behavior is symmetric (closes Qodo The-PR-Agent#1).
    - Guard int(max_lines_allowed) with TypeError/ValueError fallback to 800
      plus a targeted warning (Qodo The-PR-Agent#2).
    - Bitbucket get_pr_agent_repo_custom_file: only accept HTTP 200, log
      non-404 failures, add 10s timeout, and use the repo default branch
      via get_repo_default_branch (Qodo The-PR-Agent#3, The-PR-Agent#5, The-PR-Agent#6).
    - LocalGitProvider get_pr_agent_repo_custom_file: resolve and verify the
      candidate path stays inside the repo root before reading (Qodo The-PR-Agent#7).
    - Soften prompt wording in code-suggestions templates and add a parallel
      block in pr_reviewer_prompts.toml so the model treats the section as
      guidance, ignoring obvious non-guideline content.
    - Drop unused _FakeContext test helper, retarget patches to the new
      module, add coverage for the invalid max_lines fallback (Qodo The-PR-Agent#4).
    - Update docs/improve.md and docs/review.md to reflect that both tools
      now consume best_practices.md in OSS.
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    IsmaelMartinez referenced this pull request in IsmaelMartinez/pr-agent May 11, 2026
    UnicodeDecodeError is not a subclass of OSError, so a single non-UTF-8
    SKILL.md or sibling resource would propagate out of get_skills_context()
    and break /review, /improve, /describe whenever skills were enabled.
    Both reads now catch (OSError, UnicodeDecodeError); the offending file
    is logged and skipped.
    
    Tests cover both SKILL.md and resource paths.
    
    Addresses Qodo finding #3 on PR The-PR-Agent#2385.
    @dellch dellch mentioned this pull request Jun 2, 2026
    3 tasks done
    Oxygen56 added a commit to Oxygen56/pr-agent that referenced this pull request Jun 8, 2026
    - Use compiled Asana patterns (_ASANA_TASK_URL_PATTERN,
      _ASANA_TASK_SHORT_PATTERN) in find_asana_tickets() instead of
      inline regex (CodeQL unused-variable, comments The-PR-Agent#5/The-PR-Agent#6).
    - Add re.IGNORECASE flag to _ASANA_TASK_SHORT_PATTERN for proper
      case-insensitive matching.
    - Replace substring match ('app.asana.com' in ticket) with
      prefix check (ticket.startswith()) to fix CodeQL URL
      sanitization warning (comment The-PR-Agent#4).
    - Reserve at least one slot for Asana tickets during
      truncation when there are 3+ GitHub/branch tickets
      (comment The-PR-Agent#8).
    - Dedent only actual leading whitespace instead of blindly
      slicing dline[remove_count:] to avoid deleting real code
      on lines with less indentation (comments The-PR-Agent#3/The-PR-Agent#9).
    - Remove unused 'import pytest' from test file
      (comments The-PR-Agent#10/The-PR-Agent#20).
    - Add test_shorthand_mixed_case_asana and
      test_shorthand_respects_word_boundary test cases.
    Oxygen56 added a commit to Oxygen56/pr-agent that referenced this pull request Jun 8, 2026
    - Use compiled Asana patterns (_ASANA_TASK_URL_PATTERN,
      _ASANA_TASK_SHORT_PATTERN) in find_asana_tickets() instead of
      inline regex (CodeQL unused-variable, comments The-PR-Agent#5/The-PR-Agent#6).
    - Add re.IGNORECASE flag to _ASANA_TASK_SHORT_PATTERN for proper
      case-insensitive matching.
    - Replace substring match ('app.asana.com' in ticket) with
      prefix check (ticket.startswith()) to fix CodeQL URL
      sanitization warning (comment The-PR-Agent#4).
    - Reserve at least one slot for Asana tickets during
      truncation when there are 3+ GitHub/branch tickets
      (comment The-PR-Agent#8).
    - Dedent only actual leading whitespace instead of blindly
      slicing dline[remove_count:] to avoid deleting real code
      on lines with less indentation (comments The-PR-Agent#3/The-PR-Agent#9).
    - Remove unused 'import pytest' from test file
      (comments The-PR-Agent#10/The-PR-Agent#20).
    - Add test_shorthand_mixed_case_asana and
      test_shorthand_respects_word_boundary test cases.
    ashearin added a commit to ashearin/pr-agent that referenced this pull request Jun 29, 2026
    - Add GitProvider.publish_managed_labels with a default implementation
      that preserves existing read-modify-write semantics for non-GitLab
      providers (no behavior change for GitHub, Bitbucket, Gitea, etc.).
    - Override in GitLabProvider to refresh the MR exactly once and compute
      both the user-label filter and the add/remove diff against that single
      snapshot. This closes the cross-method race where a caller's
      get_pr_labels(update=True) and publish_labels' internal refresh
      produced two snapshots, allowing a label added between them to be
      removed via current - desired.
    - /describe (_safe_publish_labels) and /review (set_review_labels) now
      call publish_managed_labels with a managed-label predicate instead of
      doing their own pre-read + manual merge + publish_labels.
    - Refactor publish_labels to share _publish_labels_against(mr, desired)
      with publish_managed_labels so the two write paths cannot drift.
    - _safe_publish_labels now catches a narrow set of expected
      provider/network errors (ConnectionError, TimeoutError, OSError,
      ValueError, KeyError, AttributeError) instead of bare Exception, so
      programmer errors surface to /describe's outer handler.
    - Strengthen publish_labels tests to capture add_labels / remove_labels
      at save-time via a save() side_effect and assert the exact
      comma-separated wire payload.
    - Add six tests for publish_managed_labels covering single-refresh,
      user-label preservation, no-op when nothing changes, removal of all
      managed labels when desired is empty, abort on refresh failure, and
      diff-attr cleanup on save() failure.
    
    Addresses Qodo review items #1 (broad except in _safe_publish_labels),
    The-PR-Agent#2 (cross-method label race), and The-PR-Agent#3 (weak test payload assertions) on
    PR The-PR-Agent#2483.
    
    Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
    ashearin added a commit to ashearin/pr-agent that referenced this pull request Jun 29, 2026
    …h failures via typed exception
    
    Addresses Qodo review items The-PR-Agent#2, The-PR-Agent#3, The-PR-Agent#4 on PR The-PR-Agent#2483.
    
    The-PR-Agent#2 Hardcoded managed_default label set
    - Add is_describe_managed_label() and _describe_managed_label_names() in
      pr_agent.algo.utils as the single source of truth for the
      /describe-managed namespace.
    - Rewrite get_user_labels() to defer to the same helper so the inclusion
      and exclusion rules can never drift.
    
    The-PR-Agent#3 Default label not managed (Bug fix with tests)
    - When enable_custom_labels=True and no custom_labels are configured,
      set_custom_labels injects defaults that include 'Bug fix with tests'.
      is_describe_managed_label now classifies that label as managed so
      /describe can remove it once it is no longer recommended.
    - This also fixes a pre-existing bug in get_user_labels where
      'Bug fix with tests' was misclassified as a user label.
    
    The-PR-Agent#4 Refresh failure misreported
    - Add LabelRefreshError in pr_agent.git_providers.git_provider so
      callers can distinguish a refresh failure from a genuine no-op.
    - GitProvider.publish_managed_labels (default impl) and
      GitLabProvider.publish_managed_labels now raise LabelRefreshError on
      pre-write refresh failure instead of returning None.
    - PRDescription._safe_publish_labels and PRReviewer.set_review_labels
      catch LabelRefreshError specifically and log a warning that names the
      failure, instead of mis-logging it as 'labels unchanged' /
      'already set'.
    
    #1, The-PR-Agent#5, The-PR-Agent#6, The-PR-Agent#7 from Qodo's review are already addressed in earlier
    commits on this branch (36ec454, a7a8cad); Qodo's review listing is
    pinned to PR-level diff hunks so they appear in the report against
    older revisions.
    
    Tests:
    - New TestDescribeManagedLabelNamespace locks the predicate behavior:
      default-set always managed, Bug fix with tests managed under the
      custom-labels default-injection path, and is_describe_managed_label /
      get_user_labels stay disjoint.
    - TestSafePublishLabels gains test_predicate_includes_bug_fix_with_tests_when_custom_labels_default
      and test_logs_distinctly_on_refresh_failure.
    - test_pr_reviewer_core gains test_set_review_labels_logs_distinctly_on_refresh_failure.
    - test_publish_managed_labels_aborts_when_refresh_fails replaced with
      test_publish_managed_labels_raises_when_refresh_fails.
    - Full unit suite: 1066 passed, 1 skipped, 3 xfailed (was 1060).
    
    Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
    utsab345 referenced this pull request in utsab345/pr-agent Jul 3, 2026
    - Add _next_page_url() helper and paginate _find_existing_check_run
      to follow GitHub Link header across pages (Qodo finding The-PR-Agent#8)
    - Pass name="config-errors" to handle_configurations_errors so it
      doesn't clobber other check-run output (Qodo finding #3)
    - Fix FakeMarkdownProvider to accept the new name kwarg
    naorpeled pushed a commit that referenced this pull request Jul 3, 2026
    * fix: scope ticket cache per-PR and fix Dynaconf list merge leaks in tests
    
    - Cache key is now 'related_tickets_<md5(pr_url)>' instead of global
      'related_tickets', preventing stale tickets leaking between unrelated PRs
    - Added cache_tickets=true config flag under [pr_reviewer] to allow disabling
    - Fixed Dynaconf merge_enabled=True list append bug in both production code
      (env_bridge.py uses case-insensitive pop before set) and test helpers
      (restore_settings now calls _remove_key before every set)
    - Added azure-identity dependency for Azure DevOps provider availability
    - 1043 tests pass, 0 failures
    
    * Revert "fix: scope ticket cache per-PR and fix Dynaconf list merge leaks in tests"
    
    This reverts commit 7f0d154.
    
    * feat: support GitHub Checks API as output mechanism (#1400)
    
    Add `github.publish_as_check_run` config option (default `false`) that
    routes persistent tool output (review, describe, improve) to GitHub
    Check Runs instead of PR comments. Check runs appear in the dedicated
    Checks tab, reducing comment noise on the main PR conversation.
    
    - `GithubProvider.publish_persistent_comment` delegates to
      `_publish_check_run` when the flag is enabled
    - Check runs are created on first invocation and updated on subsequent
      calls (tracked per tool name via `_check_run_ids` dict)
    - Falls back to comments gracefully on API errors
    
    * fix: address bot review comments for Checks API (#1400)
    
    - Move _check_run_ids from class-level to instance-level dict
    - Use self.last_commit_id.sha instead of commit object
    - Remove unused headers variable (F841)
    - Add fallback to PR comment when check run API fails
    
    * fix: address remaining bot review comments for Checks API (#1400)
    
    - Use separate update_body without head_sha for PATCH requests
    - Truncate text payload to 65535 chars (GitHub API limit)
    
    * fix: remove exception details from log to avoid leaking API request info
    
    * fix: address review feedback - fix requestJsonAndCheck unpacking, persistent check-run lookup, add tests
    
    * docs: document publish_as_check_run and synchronize event in action setup
    
    * chore: remove accidentally added skpro submodule
    
    * chore: add skpro to gitignore
    
    * fix: address Qodo findings - guard last_commit_id with getattr, add check_run support to improve path
    
    * fix: address Qodo findings on check-run output clobbered and pagination
    
    - Add _next_page_url() helper and paginate _find_existing_check_run
      to follow GitHub Link header across pages (Qodo finding #8)
    - Pass name="config-errors" to handle_configurations_errors so it
      doesn't clobber other check-run output (Qodo finding #3)
    - Fix FakeMarkdownProvider to accept the new name kwarg
    
    ---------
    
    Co-authored-by: Utsab <utsab@pr-agent.dev>
    naorpeled added a commit to tharatynowicz/pr-agent that referenced this pull request Aug 8, 2026
    …view
    
    Rework the state-leak fix from a full 'restore all settings to a startup
    snapshot' into a surgical per-key revert, and address Qodo's review of The-PR-Agent#2346.
    
    Why the rework: a blanket snapshot-restore at the top of apply_repo_settings()
    also wipes legitimate per-request/base config that current main sets before the
    call (config.extra_config_url, config.is_auto_command, mosaico flags, ...),
    regressing 11 existing tests. Instead, note_repo_setting_override() records the
    pre-override value of each key a repo/extra .pr_agent.toml writes, and
    reset_repo_settings_overrides() reverts exactly those keys on the next load.
    
    This addresses the review findings:
    - The-PR-Agent#1 (is_auto_command wiped): flags set outside the repo-settings merge are
      never recorded, so they are never reverted by the second apply_repo_settings().
    - The-PR-Agent#2 (reset missed context settings): record/revert both go through
      get_settings(), so a per-request context['settings'] clone is handled too.
    - The-PR-Agent#3 (non-atomic global reset): record/revert are guarded by an RLock and touch
      only the overridden keys; full cross-request isolation still relies on a
      per-request clone.
    
    Also uses Dynaconf unset(force=True) (a plain unset() is a no-op) so a
    repo-injected key that did not exist at baseline is actually removed on revert.
    
    Tests: extend tests/unittest/test_apply_repo_settings.py with cases for flag
    preservation, non-repo config survival, and revert targeting the effective
    settings object. Full unit suite: 1717 passed.
    
    Co-authored-by: Tomasz Haratynowicz <75249676+tharatynowicz@users.noreply.github.com>
    ira-at-work referenced this pull request in Agrematch/pr-agent Sep 28, 2026
    …e fix
    
    - Regenerate the config reference so the documented no_temperature_models
      default includes the GLM-5 entries added in the previous commit (the docs
      build guard would otherwise catch this drift, per Qodo finding #1).
    - Extend the Kimi K3 completion test to also cover the GLM-5 bare, regional,
      and Converse spellings, since the model list added a second model with no
      matching coverage (Qodo finding #2).
    - Reword the test docstring to imperative phrasing (Qodo finding The-PR-Agent#4).
    
    Qodo finding #3 (import order) is a false positive: `ruff check` against this
    repo's actual pyproject.toml config passes the original tomllib-then-pathlib
    order unchanged (straight imports sort before from-imports within a section
    by default); left as-is.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    ira-at-work referenced this pull request in Agrematch/pr-agent Sep 28, 2026
    …e fix
    
    - Regenerate the config reference so the documented no_temperature_models
      default includes the GLM-5 entries added in the previous commit (the docs
      build guard would otherwise catch this drift, per Qodo finding #1).
    - Extend the Kimi K3 completion test to also cover the GLM-5 bare, regional,
      and Converse spellings, since the model list added a second model with no
      matching coverage (Qodo finding #2).
    - Reword the test docstring to imperative phrasing (Qodo finding The-PR-Agent#4).
    
    Qodo finding #3 (import order) is a false positive: `ruff check` against this
    repo's actual pyproject.toml config passes the original tomllib-then-pathlib
    order unchanged (straight imports sort before from-imports within a section
    by default); left as-is.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    ira-at-work referenced this pull request in Agrematch/pr-agent Sep 28, 2026
    …e fix
    
    - Regenerate the config reference so the documented no_temperature_models
      default includes the GLM-5 entries added in the previous commit (the docs
      build guard would otherwise catch this drift, per Qodo finding #1).
    - Extend the Kimi K3 completion test to also cover the GLM-5 bare, regional,
      and Converse spellings, since the model list added a second model with no
      matching coverage (Qodo finding #2).
    - Reword the test docstring to imperative phrasing (Qodo finding The-PR-Agent#4).
    
    Qodo finding #3 (import order) is a false positive: `ruff check` against this
    repo's actual pyproject.toml config passes the original tomllib-then-pathlib
    order unchanged (straight imports sort before from-imports within a section
    by default); left as-is.
    
    Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    enhancement New feature or request

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    4 participants